var yzm_btn = document.querySelector(".yzm-btn");

yzm_btn.addEventListener("click",function(){
    getYzm(yzm_btn);
})

var reg = /^(\d|\w){8,20}$/;
var password = document.querySelector("#password");
var repassword = document.querySelector("#repassword");
var register_btn = document.querySelector(".register-btn");
var nickName = document.querySelector("#nickName");
register_btn.addEventListener("click",function(){
    var pwd = password.value;
    var repwd = repassword.value;
    var name = nickName.value;
    console.log(reg.test(pwd));
    console.log(pwd);
    if(name && repwd && pwd){
        if(reg.test(pwd)==false){
            msg_box_open(msg_box_close);
            img.setAttribute("src","../images/cry.png");
            msg_text.innerText = "密码格式错误";
          
        }else if(repwd!=pwd){
            msg_box_open(msg_box_close);
            img.setAttribute("src","../images/cry.png");
            msg_text.innerText = "密码不一致";
        }else{
            msg_box_open(msg_box_close);
            
            img.setAttribute("src","../images/smile.png");
            msg_text.innerText = "注册成功!";
        }
    }else{
        msg_box_open(msg_box_close);
        img.setAttribute("src","../images/cry.png");
        msg_text.innerText = "信息不完整";
    }
    
})


var back_btn = document.querySelector(".back-btn");

back_btn.addEventListener("click",function(){
    goBack();
})


